package com.example.xiaomi.mapper;

import com.example.xiaomi.entity.topic;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TopicMapper {

    //话题总数统计
    @Select("select count(*) as topic_total_num from film;")
    List<topic> findTopicAccount();

    //表格数据and分页的结合数据展示
    @Select("select * from countinfo where topic like '%${topic}%'")
    List<topic> findAllTopics(@Param("topic") String topic);



    //模糊查询平衡容器方法
    @Select("select * from countinfo where topic  LIKE '%${topic}%'")
    List<topic> findAllTopic(@Param("topic") String topic);

    //模糊查询
    @Select("select * from film where topic  LIKE '%${topic}%'")
    List<topic> findTopics(@Param("topic") String topic);

    //echart数据的查询
    @Select("select date, count(*) as num_topic from film group by date order by date;")
    List<topic> findTopicByDate();
//    @Select("SELECT  COUNT(*) AS num_topic\n" +
//            "FROM film\n" +
//            "WHERE  topic != ' '\n" +
//            "GROUP BY topic;")
//    List<topic> findTopicCount();


}
